package com.lhd.creational.prototype;

/**
 * @Author: liuhd
 * @Date: 2024/10/20 14:25
 * @Description: 原型设计模式
 */
public class Prototype implements Cloneable{

    public Prototype(){
        System.out.println("原型创建成功");
    }

    @Override
    public Prototype clone() {
        try {
            Prototype clone = (Prototype) super.clone();
            System.out.println("克隆成功");
            return clone;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError();
        }
    }
}
